package com.itheima.dao;

import java.util.Scanner;

/*
* 数组基本查找
* */
public class Arr8 {
    public static void main(String[] args) {
        int [] arr= {23,54,76,34,56};
        Scanner sc= new Scanner(System.in);
        System.out.println("请输入您要查找的数字");
        int num = sc.nextInt();
        int index=-1;
        for (int i = 0; i < arr.length; i++) {
            if (num==arr[i]){
                //给找出来的索引位置赋值给index;
                index=i;
                break;
            }
        }
        System.out.println(index);
    }

}
